<template>
  <div>
    <FilterTable
      height="auto"
      ref="dealerRoleTable"
      :columns="approveColumns"
      :dataSource="approveRecordList"
      :isSelectColumn="isSelectColumn"
      :datakey="'records'"
      :isToperInfo="false"
      :onColumnsChange="approveColumns => (this.approveColumns = approveColumns)"
      columnsRef="notification_maintain_info_02"
    >
    </FilterTable>
  </div>
</template>

<script>
import {getAllUser} from '@/api/customerRepair/activityVisit/resultEntry/index';
import { getApproveRecord } from '@/api/partsmanage/aduitOrder/aduitClaim';
export default {
  name: "approveHistory",
  props:{
    value: {
      xtspid: Object,
      xtsplx: Object,
      required: true
    },
  },
  data() {
    return {
      approveColumns: this.creatHeaderApproveColumns(),
      isSelectColumn: false,
      approveRecordList: [],
    }
  },
  created() {
    // this.initColunm()
    this.initData()
  },
  methods: {
    creatHeaderApproveColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.$index + 1}</span>;
          }
        },
        { title: '审核日期', dataIndex: 'created_at', sorter: true, dateFormat: 'yyyy-MM-dd hh:mm:ss', },
        { title: '审核人', dataIndex: 'created_name', sorter: true },
        { title: '审核状态', dataIndex: 'xtspzt', sorter: true },
        { title: '审核意见', dataIndex: 'xtspnr', sorter: true }
      ];
    },
    async initColunm() {
      let res= await getAllUser();
      this.approveColumns.find(x => x.dataIndex == 'created_by').dictItems = res.data.map(x => ({text: x.employeeName, value: x.userId}));
    },
    initData() {
      getApproveRecord(this.value).then(response => {
        this.approveRecordList = response.data.records
      })
    }
  }
}
</script>
